
<div class="table-body">
    <div class="layui-card-header">编辑发货地址</div>
    <div class="layui-card">
        <form class="layui-form layui-form-pane">
            <div style="padding: 30px;" class="layui-form ">
                <div class="layui-form-item">
                    <label class="layui-form-label">发货人：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="name" value="{$data.name}" required lay-verify="required" placeholder="请输入发货人" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">联系手机：</label>
                    <div class="layui-input-inline seller-inline-5">
                        <input type="text" name="mobile" value="{$data.mobile}"  required lay-verify="required" placeholder="请输入手机号码" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">发货地区：</label>
                    <div class="layui-input-inline seller-inline-5 address-class">
                        {zbshop:area name='area_id' value="data.area_id" class="select-address" lay-verify="required"/}
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">发货地址：</label>
                    <div class="layui-input-inline from-inline-3">
                        <input type="text" name="address" value="{$data.address}" required lay-verify="required" placeholder="请输入发货地址" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">是否默认：</label>
                    <div class="layui-input-inline">
                        <input type="radio" name="is_def" value="1" title="是" {eq name="data['is_def']" value="1"}checked{/eq}/>
                        <input type="radio" name="is_def" value="2" title="否" {eq name="data['is_def']" value="2"}checked{/eq}/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block" style="padding-top: 20px;">
                        <input type="hidden" name="id" value="{$data.id}">
                        {:zbToken()}
                        <button class="layui-btn save-ship" lay-submit="" lay-filter="add-ship">保存</button>
                        <a href="javascript:history.back(-1);" class="layui-btn layui-btn-primary" lay-filter="cancleAuthor">返回</a>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
<script>
    layui.use(['table','form','layer'],function(){
        var layer = layui.layer, form = layui.form,$ = layui.$;
        form.render();
        form.on('submit(add-ship)', function(data){
            JsPost("{:url('shop/edit')}",data.field,function (res) {
                if(res.code===1){
                    layer.msg(res.msg, {icon: 6},function(){
                        window.location.href = "{:url('address')}";
                    });
                }else{
                    layer.msg(res.msg,{icon: 5});
                }
            });
            return false;
        });
    });
</script>